Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E-Document Core] - Allow to recreate unposted purchase documents from an incoming e-document #27973

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

GMatuleviciute
Copy link
Collaborator

@GMatuleviciute GMatuleviciute commented Jan 22, 2025

This pull request does not have a related issue as it's part of the delivery for development agreed directly with @altotovi @Groenbech96

Implementation

A new feature allows users to recreate unposted purchase credit memos, purchase invoices, and purchase orders from incoming e-documents. This update addresses cases where a user mistakenly deletes a document (purchase credit memo, invoice, or order) created from an incoming e-document.

  • If a purchase credit memo, purchase invoice, or purchase order created from an incoming e-document is deleted before posting, the user can recreate it using the "Reprocess Document" action on the E-Document card. The system checks whether a connected document already exists. If not, a new document is automatically recreated with all the details from the original incoming e-document.

  • If a connected document exists, the user can use the "Delete Related Document" action to remove it, allowing the recreation process to proceed. After deletion, the "Document Status" is changed to "In Progress." Note that recreation applies only to unposted purchase credit memos, invoices, and orders.

  • Deletion of the related document is recorded in the E-Document Logs with the status "Imported document deleted." Meanwhile, recreation using the "Reprocess Document" action is recorded with the status "Imported document created." All these statuses are displayed on the Service Status fast tab as well.

Fixes #

Copy link
Contributor

Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed. Use that pattern for every issue you want to link.

@JesperSchulz JesperSchulz added the Integration GitHub request for Integration area label Jan 22, 2025
@JesperSchulz JesperSchulz changed the title [E-Document Core] - Allow to recreate unposted purchase documents from an incoming e-document [DRAFT][E-Document Core] - Allow to recreate unposted purchase documents from an incoming e-document Jan 27, 2025
@GMatuleviciute GMatuleviciute marked this pull request as ready for review February 7, 2025 08:47
@GMatuleviciute GMatuleviciute requested review from a team as code owners February 7, 2025 08:47
@GMatuleviciute GMatuleviciute changed the title [DRAFT][E-Document Core] - Allow to recreate unposted purchase documents from an incoming e-document [E-Document Core] - Allow to recreate unposted purchase documents from an incoming e-document Feb 7, 2025
Copy link
Contributor

@Groenbech96 Groenbech96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

RecRef: RecordRef;
begin
if this.GetRelatedRecord(EDocument, RecRef) then
if RecRef.Number = Database::"Purchase Header" then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This model is insufficient.
Assumption should be that any document type can be deleted.
In case that document is posted it cannot.
How do you know document is posted? E-Doc state Completed should indicate that.


EDocumentLog.InsertLog(EDocument, EDocumentService, EDocServiceStatusDeleted);
EDocumentProcessing.ModifyServiceStatus(EDocument, EDocumentService, EDocServiceStatusDeleted);
EDocumentProcessing.ModifyEDocumentStatus(EDocument, EDocServiceStatusDeleted);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not handled properly. This new status is not taken into account inside the function.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new status translates to "In Progress" E-Document status so it will be handled in this procedure

if IsNullGuid(Rec."E-Document Link") then
exit;

EDocument.GetBySystemId(Rec."E-Document Link");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we cant find it, lets just exit. We should probably not block delete of header.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added check to exit if EDocument not found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Integration GitHub request for Integration area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants